package com.ff.neuropp.controller;


import com.ff.neuropp.domain.Contacts;
import com.ff.neuropp.service.AppConstactsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/app/constacts")
@Api(value = "app通讯录controller", tags = {"app通讯录接口"})
public class AppContactsController {

    @Autowired
    private AppConstactsService appConstactsService;


    @GetMapping("/list")
    @ApiOperation(value = "通讯录列表", notes = "通讯录列表")
    public Map<String,Object> list(@ApiParam(required = true,value = "userId") @RequestParam String userId){
        return appConstactsService.constacts(userId);
    }

    @PostMapping("/apply")
    @ApiOperation(value = "申请好友关系", notes = "申请好友关系")
    public Map<String,Object> mapping(@RequestBody Contacts param){
        return appConstactsService.mapping(param);
    }

    @PostMapping("/update")
    @ApiOperation(value = "更新关系", notes = "更新关系")
    public Map<String,Object> update(@RequestBody Contacts param){
        return appConstactsService.update(param);
    }
    


    @GetMapping("/detail")
    @ApiOperation(value = "通讯录个人详情", notes = "通讯录个人详情")
    public Map<String,Object> detail(@ApiParam(required = false, value = "用戶ID") @RequestParam(required = true) String  userId){
        return appConstactsService.detail(userId);
    }
    

}
